#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright [Gtlions Lai].
# Create Date:
# Update Date:
"""summarization ahout this script.

detail ahout this script

    Class(): summarization about Class
    ...
    function(): summarization about function
    ...
"""
__authors__ = '"Gtlions Lai" <gtlions.l@qq.com>'
import cx_Oracle
import os
import csv

os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8'
f = open("oracle.csv", "w")
writer = csv.writer(f, lineterminator="\n", quoting=csv.QUOTE_NONNUMERIC)
dbora = cx_Oracle.connect("gtlions", "000000", "192.168.100.60:1521/gt11g")
cursor = dbora.cursor()
cursor.execute("select id,name from test")
for row in cursor:
    print row
    writer.writerow(row)
f.close()

reader = csv.reader(open("oracle.csv", "r"))
lines = []
for line in reader:
    lines.append(line)

print lines
cursor.executemany("insert into test values(:1,:2)", lines)
dbora.commit()
